package com.dhcc.bpm.alarm.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dhcc.bpm.alarm.entity.AlarmFtpInfoConfig;
import com.dhcc.bpm.alarm.mapper.AlarmFtpInfoConfigMapper;
import com.dhcc.bpm.alarm.service.IAlarmFtpInfoConfigService;
import com.dhcc.bpm.alarm.utils.SSHExecutor;
import com.dhcc.bpm.alarm.vo.AlarmFtpInfoConfigVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author xiafayu
 * @since 2022-02-16
 */
@Service
public class AlarmFtpInfoConfigServiceImpl extends ServiceImpl<AlarmFtpInfoConfigMapper, AlarmFtpInfoConfig> implements IAlarmFtpInfoConfigService {
    @Autowired
    AlarmFtpInfoConfigMapper alarmFtpInfoConfigMapper;

    @Override
    public IPage<AlarmFtpInfoConfigVO> selectAlarmFtpInfoConfigPage(IPage<AlarmFtpInfoConfigVO> page, AlarmFtpInfoConfigVO AlarmFtpInfoConfig) {
        return page.setRecords(alarmFtpInfoConfigMapper.selectAlarmFtpInfoConfigPage(page, AlarmFtpInfoConfig));
    }

    @Override
    public Object testConnection(AlarmFtpInfoConfig alarmFtpInfoConfig) {
        SSHExecutor sshExecutor = new SSHExecutor();
        return sshExecutor.getSSHSession(alarmFtpInfoConfig);
    }

}
